<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <script src="vue.js"></script>
    <title>Document</title>
    <style>
    #one{
        width:300px;
        height: 3px;
        border: 1px solid black;
        margin: 20px 0;
        border-radius: 3px;
        
    }
    #qiu{
        width: 15px;
        height: 15px;
        border: 1px solid black;
        border-radius: 15px;
        position: relative;
        top:-30px;
    }
    
    </style>
</head>
<body>
     <main id="app">
          <input type="text" v-model='content' >
          <star-com v-model='content'></star-com>
     </main>
     <script  id="first" type="text/html">
      <main>
        <div @click='firstclick($event)' id='one'>  </div>
        <section  id='qiu' :style='leftStyle'></section>
      </main>
     </script>
     
     <script>
         Vue.component('star-com',{
             template:'#first',
             props:['value'],
             data:function(){
                 return {
                    number:this.value
                 }
             },
             
           
             methods:{
                 firstclick:function(value){
                     this.$emit('input',value)
                  
             }
             }, 
             computed:{
                 leftStyle:function(){
                     return {
                        left:this.value*3 +'px'
                     }
                 }
             }
         })
     var vue =new Vue({
         el:'#app',
         data:{
                content:''    
         }  
     })
     </script>
</body>
</html>